<template>
  <div id="app">
    <router-view v-slot="{ Component }">
      <component :is="Component" @start-guide="handleStartGuide" />
    </router-view>
  </div>
</template>

<script>
import { initDriver } from '@/utils/guide'

export default {
  name: 'App',
  methods: {
    handleStartGuide(step = 0) {
      const driver = initDriver()
      if (step > 0) {
        driver.drive(step)
      } else {
        driver.drive()
      }
    }
  },
  mounted() {
    // 检查是否需要显示引导
    const hasShownGuide = localStorage.getItem('hasShownGuide')
    if (!hasShownGuide) {
      setTimeout(() => {
        this.handleStartGuide()
        localStorage.setItem('hasShownGuide', 'true')
      }, 1500)
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
/* 在 main.css 或 App.vue 的 style 部分 */
.driver-popover {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.driver-popover-title {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
}

.driver-popover-description {
  font-size: 14px;
  color: #495057;
}

.driver-popover-footer {
  justify-content: space-between;
}

.help-button {
  margin-left: 10px;
  background-color: #f8f9fa;
  color: #2c3e50;
}
</style>